package mapgenerator;


import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;


/**
 *
 * @author DMC
 */
public class PanelObject extends JPanel implements Runnable{

  //  ImageManager imgMgr;
    Thread th;
    BufferedImage img;
    int height = 256;
    int width  = 256;
    int hGap    = 10; // in pixel
    int vGap    = 10;

    boolean paused=false;
    boolean stoped=false;

    public PanelObject(){
        super();
    }

    public void setImage(String imgName){
        //img = ImageManager.getImge(imgName);
    }

    public void paintComponent(Graphics g){
        super.paintComponent(g);
        g.drawImage(img, hGap, hGap, this);
    }

    public void run() {

        while(!stoped){
            if(!paused){
                //imgseq.update();
                repaint();

                try{
                    Thread.sleep(100);
                }catch(Exception e){

                }
            }
        }
    }
    
    public void start(){
        th = new Thread(this);
        th.start();
    }


    public void pause(){
        paused=true;
    }
    
    public void resume(){
        paused=false;
    }
    
    public void stop(){
        stoped =true;
    }

}
